import { Service } from "egg";

export default class AccountService extends Service {
  // 重新链接
  async reconnection(wxGeweToken: string, params: { appId: string }) {
    const { ctx } = this;
    const client = await ctx.service.geweChat.client.getGeweChatSdk(wxGeweToken);
    const res = await client.exec("login/reconnection", params);

    return res;
  }
  // 退出登陆
  async logout(wxGeweToken: string, params: { appId: string }) {
    const { ctx } = this;

    const client = await ctx.service.geweChat.client.getGeweChatSdk(wxGeweToken);
    const res = await client.exec("login/logout", params);

    return res;
  }

  // 检查是否在线
  async checkOnline(wxGeweToken: string, params: { appId: string }) {
    const { ctx } = this;

    const client = await ctx.service.geweChat.client.getGeweChatSdk(wxGeweToken);
    const res = await client.exec("login/checkOnline", params);

    return res;
  }
}
